package com.shop.cereshop.app.async;

import com.shop.cereshop.app.dao.recommend.CereRecommendTrendsDAO;
import lombok.RequiredArgsConstructor;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;

@Service
@RequiredArgsConstructor
public class RecommendAsyncService {
    private final CereRecommendTrendsDAO cereRecommendTrendsDAO;

    @Async
    public void updateRecommendLikeCount(Long recommendId, Integer addOrDeleType, Integer likeType) {
        if (likeType == 1) {
            if (addOrDeleType == 1) {
                //删除动态表的点赞数
                cereRecommendTrendsDAO.deleDaysLikesCount(recommendId);
            } else {
                //增加动态表的点赞数
                cereRecommendTrendsDAO.addDaysLikesCount(recommendId);
            }
        }
    }
}
